package com.founder.gateway.service.impl;

import com.founder.gateway.orm.fzapi.bean.entity.BlogEntity;
import com.founder.gateway.orm.fzapi.bean.entity.UserEntity;
import com.founder.gateway.service.BlogService;
import org.springframework.stereotype.Service;

/******************************************************************************
 * @Package: [com.founder.gateway.service.impl.BlogServiceImpl]
 * @ClassName: [BlogServiceImpl]
 * @Description: [一句话描述该类的功能]
 * @Author: [fengli@founder.com.cn]  
 * @CreateDate: [2019/1/11 17:19]   
 * @UpdateUser: [fengli@founder.com.cn (如多次修改保留历史记录，增加修改记录)]   
 * @UpdateDate: [2019/1/11 17:19，(如多次修改保留历史记录，增加修改记录)]   
 * @UpdateRemark: [说明本次修改内容, (如多次修改保留历史记录 ， 增加修改记录)]
 * @Version: [v1.0]
 * ${tags}
 */
@Service("blogService")
public class BlogServiceImpl implements BlogService{
    @Override
    public BlogEntity getBlogInfo(String blogId) {
        BlogEntity blogEntity=new BlogEntity();
        blogEntity.setId(blogId);
        blogEntity.queryBySelf();

        UserEntity userEntity=new UserEntity();
        userEntity.setId(blogEntity.getUserId());
        userEntity.queryBySelf();

        blogEntity.setUser(userEntity);
        return blogEntity;
    }

    @Override
    public void addBlog(BlogEntity blogEntity) {
        blogEntity.insertSelf();
    }

    @Override
    public BlogEntity updateBlog(BlogEntity blogEntity) {
        blogEntity.updateBySelfId();
        return blogEntity;
    }
}
